﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DDD;
using Xunit;

namespace DokiDokiTest {
    public class TestKeyframe {
        [Fact]
        public void Test_New1 () {
            var fr1 = new Keyframe<int> (1, 100);
            var fr2 = new Keyframe<int> (2, 100, 200);
            var fr3 = new Keyframe<int> (3, 100, 200, 300);
            var fr4 = new Keyframe<int> (4, 100, 200, 300, 400);
            
            Assert.Equal (1, fr1.ComponentCount);
            Assert.Equal (2, fr2.ComponentCount);
            Assert.Equal (3, fr3.ComponentCount);
            Assert.Equal (4, fr4.ComponentCount);

            Assert.Equal (1, fr1.Time);
            Assert.Equal (2, fr2.Time);
            Assert.Equal (3, fr3.Time);
            Assert.Equal (4, fr4.Time);

            Assert.Equal (100, fr1.Value[0]);

            Assert.Equal (100, fr2.Value[0]);
            Assert.Equal (200, fr2.Value[1]);

            Assert.Equal (100, fr3.Value[0]);
            Assert.Equal (200, fr3.Value[1]);
            Assert.Equal (300, fr3.Value[2]);

            Assert.Equal (100, fr4.Value[0]);
            Assert.Equal (200, fr4.Value[1]);
            Assert.Equal (300, fr4.Value[2]);
            Assert.Equal (400, fr4.Value[3]);
        }

        [Fact]
        public void Test_New2 () {
            var value = new int[] { 100, 200, 300, 400, 500 };
            var fr = new Keyframe<int> (5, value);

            value[0] = 999;

            Assert.Equal (5, fr.ComponentCount);
            Assert.Equal (5, fr.Time);
            Assert.Equal (100, fr.Value[0]);
            Assert.Equal (200, fr.Value[1]);
            Assert.Equal (300, fr.Value[2]);
            Assert.Equal (400, fr.Value[3]);
            Assert.Equal (500, fr.Value[4]);

        }

    }
}
